﻿// <com.woyouqiu.Copyright>
// --------------------------------------------------------------
// <copyright>上海有求网络科技有限公司 2015</copyright>
// <Solution>Vecen.BangChuang</Solution>
// <Project>Vecen.BangChuang.Web.Host</Project>
// <FileName>EmptyStringValueProvider.cs</FileName>
// <CreateTime>2017-05-04 15:37</CreateTime>
// <Author>何苗</Author>
// <Email>hemiao@woyouqiu.com</Email>
// <log date="2017-05-04 15:37" version="00001">创建</log>
// --------------------------------------------------------------
// </com.woyouqiu.Copyright>

using System.Reflection;
using Newtonsoft.Json.Serialization;

namespace Vecen.BangChuang.Json {
    public class EmptyStringValueProvider: IValueProvider {
        private readonly IValueProvider _provider;

        public EmptyStringValueProvider(IValueProvider valueProvider) {
            _provider = valueProvider;
        }

        public object GetValue(object target) {
            return _provider.GetValue(target) ?? "";
        }

        public void SetValue(object target, object value) {
            _provider.SetValue(target, value);
        }
    }
}